package com.siyue.util;


import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import org.springframework.stereotype.Component;

/**
 * @ClassName: MD5Utils
 * @Auther: wuhao
 * @Date: 2021/3/15 17:47
 * @Description:
 */
@Component
public class MD5Utils {
    public String stringToMD5(String name, String pwd) {
        String hashAlgorithName = "MD5";
        int hashIterations = 1024;
        ByteSource credentialsSalt = ByteSource.Util.bytes(name);
        String str = new SimpleHash(hashAlgorithName, pwd, credentialsSalt, hashIterations).toString();
        return str;
    }

}
